import './style.css'
import './style.less'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import App from './App.vue'
import { createApp } from 'vue'
import { router } from './router'
import antdv from 'ant-design-vue'
import { createPinia } from 'pinia'
import { MotionPlugin } from '@vueuse/motion'
import { useMenuStore } from './store'
import { auth } from '@/hooks'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(antdv)
dayjs.locale('zh-cn')

async function bootstrap() {

  const token = localStorage.getItem('token')
  if (token) {
   await useMenuStore().GET_MENU(true)
  }

  app.use(router)
  app.use(MotionPlugin)
  app.directive('auth', auth)

  app.mount('#app')
}

bootstrap()